<?php
session_start();	
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
	$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
	$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
	$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
$action= $pageURL;
require_once dirname( __FILE__ ) . '/form-process.php';
?>
<?php get_header(); ?>
<div id="content">
	<div class="left">  
    <h2>Register Your Account</h2>      	
    <div class="question-form">
        <form action="" method="post" name="adduser" id="adduser" onsubmit="return check_form(this);" enctype="multipart/form-data" >
          <input name="action" type="hidden" id="action" value="adduser" />
        <input name="action_type" type="hidden" id="action_type" value="register" />
        <?php wp_nonce_field('add-user'); ?>	
        <?php
        //Load up the passed data, else set to a default.
        foreach ( array('user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname',
        'email' => 'email', 'url' => 'uri', 'role'=>'role') as $post_field => $var ) 
        {
            $var = "new_user_$var";
            if ( ! isset($$var) )
                $$var = isset($_POST[$post_field]) ? stripslashes($_POST[$post_field]) : '';
        }
        if($error!="")
            echo "<p>$error</p>";				
        if ( (isset($add_user_errors) && is_wp_error( $add_user_errors )) && $error=="" ) :
        ?>	
        <div class="err">
            <?php
            foreach ( $add_user_errors->get_error_messages() as $message )
            echo "<p>$message</p>";
            ?>
        </div>
        <?php endif; ?>	
            <div class="text-publish2">          
  				<p style="float:left; margin-right:10px; width:150px;">Username:*</p>
				<input class="input" type="text" size="35" name="user_login" id="user_login" value="<?php echo esc_attr($new_user_login); ?>" />
        	</div>
        	
        	<div class="text-publish2">
  				<p style="float:left; margin-right:10px; width:150px;">First Name:*</p>
				<input class="input" type="text" name="first_name" id="first_name" value="<?php echo esc_attr($new_user_firstname); ?>" size="35" />
        	</div>
        	
        	<div class="text-publish2">
  				<p style="float:left; margin-right:10px; width:150px;">Last Name:*</p>
				<input class="input" type="text" name="last_name" id="last_name" value="<?php echo esc_attr($new_user_lastname); ?>" size="35" />
        	</div>
        	
        	<div class="text-publish2">
  				<p style="float:left; margin-right:10px; width:150px;">E-mail:*</p>
				<input class="input" name="email" id="email" size="35" value="<?php echo esc_attr($new_user_email); ?>" />
        	</div>
        	
        	<div class="text-publish2">
  				<p style="float:left; margin-right:10px; width:150px;">Password:*</p>
				<input class="input" type="password" id="pass1" name="pass1" size="35" />
        	</div>
        	
        	
  			<div class="text-publish2">
  				<p style="float:left; margin-right:10px; width:150px;">Confirm Password:*</p>
				<input class="input" type="password" id="pass2" name="pass2" size="35" />
        	</div>
        	
            <div style="display:none;">
            <label for="pass1">Role <span ></span></label>
            <select name="role" id="role">
                <option value="subscribe">Subscribe</option>
            </select>
            
            <div class="cl"></div>
            </div>		
            
        	<div class="text-publish2">
  				<p style="float:left; margin-right:10px; width:150px;">Upload Your Pic:</p>
				<input type="file" name="avatar" id="avatar" class="input" size="35"/>
        	</div>
            
            <div class="text-publish2">   
            <p style="float:left; margin-right:10px; width:150px;">Secure Code:</p>        
			<input type="text" name="sec_code" maxlength="5" class="input" value="" />            
            </div>
            <div class="text-publish2">
            <p style="float:left; margin-right:10px; width:150px;"></p>   
            <?php echo '<img src="wp-content/themes/'.FOLDER_STR.'/CaptchaSecurityImages.php?width=100&height=35&characters=5" alt="captcha" />'; ?>
            </div>
        	<input style="margin-left:170px;" type="image" src="<?php echo get_bloginfo('template_directory'); ?>/images/create-btn.jpg" onclick="submit()" name="adduser" value="Register" />
			</form>
        </div>
    </div> 
  <?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>
